﻿@model HitModel
@{
    ViewBag.Title = "List";
}

@if(Model.Hits.Count > 0){
    <h2>Stat: @Model.Hits.FirstOrDefault().Stat.Name</h2>
    foreach (Hit hit in Model.Hits)
    {
        <div>
            @Html.ActionLink(hit.Date.ToString(DiaryHelper.DateFormat()), "Index", new { id = hit.Id })
            @foreach (HitComponent hitComponent in hit.HitComponents)
            {
                <div>
                    @(hitComponent.Quantity.Name):
                    @hitComponent.Amount
                    @hitComponent.Quantity.Unit.Abbreviation
                </div>
            }
        </div>
    }
    @Html.ActionLink("Back", "Index", "Stat", new { id = Model.Hits.FirstOrDefault().Stat.Id }, null)
}
else{
    <h2>There are no hits.</h2>    
}
